'use strict';
module.exports = {
	/**
	 * XXXnameXXX
	 * @url agent/callback/pub/tx_sendtest 前端调用的url参数地址
	 * data 请求参数
	 * @param {String} params1  参数1
	 */
	main: async (event) => {
		let { data = {}, userInfo, util, filterResponse, originalParam } = event;
		let { customUtil, uniID, config, pubFun, vk, db, _ } = util;
		let { uid } = data;
		let res = { code: 0, msg: "" };
		// 业务逻辑开始-----------------------------------------------------------

		let nows = new Date().getTime()
		let link = encodeURIComponent('tracking.e.qq.com')
		console.log("link=", link);
		// 回传支付事件给百度
		let tengxunurl =
			"http://tracking.e.qq.com/conv/web?clickid=o6c4qyytaaaaubiqeqia&action_time=1674085797&action_type=PURCHASE&link=" +
			link;
		let tengxunhuichuan_result = await uniCloud.httpclient.request(tengxunurl, {
			method: 'GET',
			data: {},
			contentType: 'json', // 指定以application/json发送data内的数据
			dataType: 'json' // 指定返回值为json格式，自动进行parse
		})

		// 回传记录入库
		let addhc1 = await db.collection('jl_huichuanjilu').add({
			type: "active_pay",
			platform: "tengxun",
			result: tengxunhuichuan_result.data,
			time: nows,
		})



		// 业务逻辑结束-----------------------------------------------------------
		return res;
	}
}
